﻿namespace VantTheme {

    const colorDictionary = {
        "--van-primary-color": "Accent 1",
        "--van-stepper-button-round-theme-color": "Accent 1",
        "--van-tabs-card-height": "38px"
    };

    let updated = false;

    export function updateCssAndAppend() {
        if (updated) {
            return;
        }

        let cssStr = "";

        for (let key in colorDictionary) {
            cssStr += `${key}:${Forguncy.ConvertToCssColor(colorDictionary[key])};`;
        }

        cssStr = `:root{ ${cssStr} }`;

        const style = document.createElement("style");
        style.type = "text/css";
        style.id = "FGC_Vant_Variables";
        style.innerHTML = cssStr;
        document.getElementsByTagName("head")[0].appendChild(style);

        updated = true;
    }
}